package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Description ShoppingCartMapper
 * @Author zhuzi
 * @Date 2023/10/01
 */
@Mapper
public interface ShoppingCartMapper {

    /**
     * 根据ShoppingCartDTO获取购物车信息
     *
     * @param shoppingCartDTO ShoppingCartDTO
     * @return ShoppingCart
     */
    ShoppingCart getShoppingCartByShoppingCartDTO(ShoppingCartDTO shoppingCartDTO);

    /**
     * 更新购物车商品数量
     *
     * @param shoppingCart ShoppingCart
     */
    void updateShoppingCartNumber(ShoppingCart shoppingCart);

    /**
     * 新增购物车
     *
     * @param shoppingCart ShoppingCart
     */
    void insertShoppingCart(ShoppingCart shoppingCart);

    /**
     * 根据userId获取购物车
     *
     * @param userId Long
     * @return List
     */
    List<ShoppingCart> getShoppingCartByUserId(Long userId);

    /**
     * 根据userId清除购物车
     *
     * @param userId Long
     */
    void deleteShoppingCartByUserId(Long userId);

    /**
     * 根据购物车id删除购物车
     *
     * @param id Long
     */
    void deleteShoppingCartByShoppingCartId(Long id);

    /**
     * 批量添加购物车
     *
     * @param shoppingCarts List
     */
    void insertShoppingCarts(List<ShoppingCart> shoppingCarts);

}
